;
; ------------------------------------------------------------
;
;   PureBasic - SysTray example file
;
;    (c) 2003 - Fantaisie Software
;
; ------------------------------------------------------------
;

If OpenWindow(0, 100, 150, 300, 100, "PureBasic - SysTray Example", #PB_Window_SystemMenu)

  AddSysTrayIcon(1, WindowID(0), LoadImage(0, "Data\CdPlayer.ico"))
  AddSysTrayIcon(2, WindowID(0), LoadImage(1, "Data\CdPlayer.ico"))
  SysTrayIconToolTip(1, "Icon 1")
  SysTrayIconToolTip(2, "Icon 2")
  
  Repeat
    Event = WaitWindowEvent()
    
    If Event = #PB_Event_SysTray
      If EventType() = #PB_EventType_LeftDoubleClick
        MessageRequester("SysTray", "Left DoubleClick on SysTrayIcon "+Str(EventGadget()),0)
        
        ChangeSysTrayIcon (EventGadget(), LoadImage(0, "Data\CdPlayer.ico"))
        SysTrayIconToolTip(EventGadget(), "Changed !")
      EndIf
      
    EndIf
  Until Event = #PB_Event_CloseWindow
  
EndIf 